﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Versioning;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
using Newtonsoft.Json;
namespace Ymatou.ServiceCenter.UnitTest
{
    [Resource("webapi.ymatou.com", "api/Default", Method.GET, ParameterBuildType.UrlQueryString)]
    public class DefaultGetRequest
    {

    }

    public class DefaultGetResponse : List<string>
    {
        
    }

    [Resource("webapi.ymatou.com", "api/Default/{id}", Method.GET, ParameterBuildType.UrlQueryString)]
    public class DefaultGetIdRequest
    {
        [JsonProperty("id")]//大小写必须与{id}中的单词一致
        public int Id { get; set; }
    }

    [Resource("webapi.ymatou.com", "api/Default", Method.POST, ParameterBuildType.FormUrlEncoded)]
    public class DefaultPostRequest
    {
        [BodyStringValue]//如果参数上打上了[FromBody]标签的，需要在契约的请求包的类的对应属性上打上[BodyString]标签
        public string Value { get; set; }
    }

    [Resource("webapi.ymatou.com", "api/Default", Method.PUT, ParameterBuildType.UrlQueryString)]
    public class DefaultPutRequest
    {
        
    }

    //如果一个接口中既有从url参数又有Form参数则使用ParameterBuildType.QueryOrForm方式
    [Resource("webapi.ymatou.com", "api/Default/{id}", Method.PUT, ParameterBuildType.QueryOrForm)]
    public class DefaultPutIdRequest
    {
        [QueryParameter]//使用Uri参数的形式来构建http请求参数
        [JsonProperty("id")]//大小写必须与{id}中的单词一致
        public int Id { get; set; }

        //[JsonProperty("value")]
        [BodyStringValue]
        public string Value { get; set; }
    }

    [Resource("webapi.ymatou.com", "api/Default/{id}", Method.DELETE, ParameterBuildType.UrlQueryString)]
    public class DefaultDeleteRequest
    {
        [JsonProperty("id")]
        public int Id { get; set; }
    }

     [Resource("demo1.ymatou.com", "WebFormGetTest.aspx", Method.GET, ParameterBuildType.UrlQueryString)]
    public class WebFormGetTestRequest
    {
        public string Id { get; set; }
    }

     [Resource("demo1.ymatou.com", "WebFormPostTest.aspx", Method.POST, ParameterBuildType.FormUrlEncoded)]
     public class WebFormPostTestRequest
     {
         public string Id { get; set; }
     }

    [Resource("http://www.baidu.com", "search/error.html", Method.GET, ParameterBuildType.UrlQueryString)]
    public class BaiduRequest
    {
        
    }
}
